<?php
/*
   静态实例表
*/
namespace common\models\finance;
use common\models\BaseModel;


class StaticInstanceModel extends BaseModel
{
	public static function tableName()
	{
		return "{{%static_instance}}";
	}

	public function rules() 
	{
		return [
			[['member_id','mch_id'],'required'],
			[['in_num','total_num','remain_num','was_num','bonus_num'],'double'],
			[['member_id','bonus_day','type','create_time','update_time','period_day','order_type','commodity_id'],'integer'],
			[['status'],'string']
		];
	}


	/*
		* 投资列表
		* whereArr 条件
		* params 基本参数 包含 field order page limit
		* extends  扩展信息 一些相关的信息
		* 
	*/	
	public static function investList($whereArr,$params,$extends=array())
	{
		$model  = self::find();
		$where  = $whereArr['where'];
		$whereAnd = isset($whereArr['and'])?$whereArr['and']:[];
		$models = self::queryFormart($model,$where,$params,$whereAnd);
		$model  = $models['model'];
		self::$pages = $models['pages'];

		$data  = $model->asarray()->all();
		if(!$data) return array();

		//扩展信息
		if(!$extends) return $data;
		return $data;	
	}	
}